import urllib2
import re
from xml.dom import minidom

__author__="tslawek"
__date__ ="$2008-11-21 16:43:36$"


def get_blog_text(adress):


    pat = re.compile("<DIV class=bl_body>(.*?)</DIV>")
    response = urllib2.urlopen(adress)
    html = response.read();
    s = pat.search(str(html))
    t = s.group(1)
    from htmlparser import replace_nbsp, remove_html_tags
    print replace_nbsp(remove_html_tags(t))
    print len(t)


def config_parser(file):
    DOMTree = minidom.parse(file)
    cNodes = DOMTree.childNodes

    for i in cNodes[0].getElementsByTagName("blog"):
        address = i.getElementsByTagName("adress")[0].childNodes[0].toxml();
        parser = i.getElementsByTagName("parser")[0].childNodes[0].toxml();
        type = i.getElementsByTagName("type")[0].childNodes[0].toxml();
        function = i.getElementsByTagName("fun")
        for f in function:
                x = f.childNodes[0].toxml()
                yield (parser, type, address, x)
        #yield (parser, type, address)

if __name__ == "__main__":
    print "Hello";